﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace TestersLittleHelper
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
            Resize += new EventHandler(Form1_Resize);

            MouseMove += new MouseEventHandler(Form1_MouseMove);

            createMenu();
        }

        void Form1_MouseMove(object sender, MouseEventArgs e)
        {

            notifyIcon1.BalloonTipText = String.Format("{0}x{1}",e.X,e.Y);
            notifyIcon1.ShowBalloonTip(1000);
        }

        

        private void createMenu()
        {
            foreach (int i in StringCreator.Lengths) {
                var menuItem = new ToolStripMenuItem();

                menuItem.Name = String.Format("createString{0}ToolStripMenuItem", i);
                menuItem.Size = new System.Drawing.Size(152, 22);
                menuItem.Text = String.Format("{0}",i);

                menuItem.Click += new EventHandler(createString_Clicked);

                stringToolStripMenuItem.DropDownItems.Add(menuItem);
            }
        }

        void createString_Clicked(object sender, EventArgs e)
        {
            ToolStripMenuItem item = sender as ToolStripMenuItem;
            StringCreator.CreateStringInClipboard(Int32.Parse(item.Text));
            notifyIcon1.BalloonTipText = "Text copied to clipboard";
            notifyIcon1.ShowBalloonTip(1000);
        }

        void Form1_Resize(object sender, EventArgs e)
        {
            if (WindowState == FormWindowState.Minimized)
                Hide();
        }

        private void notifyIcon1_MouseDoubleClick(object sender, MouseEventArgs e)
        {
            Show();
            WindowState = FormWindowState.Normal;
        }

        private void openToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Show();
            WindowState = FormWindowState.Normal;
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            Hide();
        }

        private void showMouseCoordsToolStripMenuItem_Click(object sender, EventArgs e)
        {

        }


    }
}
